﻿// Copyright (c) Inossem. All rights reserved.
// Licensed under the LGPL-3.0 license. See LICENSE file in the project root for full license information.
using DWF.Studio.ISerivces;
using DWF.Studio.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Management;
using System.Text;
using System.Threading.Tasks;

namespace DWF.Studio.Services
{
    internal class EnvironmentSerivce : IEnvironmentSerivce
    {
        public OSInfo GetCurrentOSInfo()
        {
            OSInfo info = new OSInfo();

            string strQuery = "select *from win32_OperatingSystem";
            SelectQuery queryOS = new SelectQuery(strQuery);
            ManagementObjectSearcher searcher = new ManagementObjectSearcher(queryOS);

            foreach (var os in searcher.Get())
            {
                info.Caption = os["Caption"].ToString();
                info.Version = os["Version"].ToString();

                break;
            }

            return info;
        }

        public string GetFrameworkVersion()
        {
            return Environment.Version.ToString();
        }
    }
}
